package com.test.hello;

import com.alibaba.excel.EasyExcel;
import com.example.dto.TopDTO;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Paths;

public class Main01 {
    public static void main(String[] args) {
        String path="C:\\Users\\lei.liu\\Desktop\\out\\excel\\test2.xlsx";
        File file= Paths.get(path).toFile();
        InputStream is = null;
        try {
            is = new FileInputStream(file);
        } catch (IOException e) {
            e.printStackTrace();
        }
        //1.进行读取数据，TestImport是我的pojo类，
        //2.new SorageListener(storageService)这个是监听器，主要用来读取数据的，别急后面会讲
        //3.特别注意的是storageService这个service，我上面有注入进去 @Autowired，切记不要new会报错
        EasyExcel.read(is, TopDTO.class, new TopListener()).sheet().headRowNumber(2).doRead();
    }
}
